package com.nail.api.customMake.service.impl;

import com.nail.api.customMake.bean.PhoneTexture;
import com.nail.api.customMake.dao.IPhoneTextureDao;
import com.nail.api.customMake.service.IPhoneTextureService;
import com.nail.service.impl.BaseService;
import com.nail.utils.PageResult;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by jie on 2017/9/17.
 */
@Service("phoneTextureService")
public class PhoneTextureServiceImpl extends BaseService implements IPhoneTextureService{
    Logger logger = Logger.getLogger(this.getClass());

    @Autowired
    IPhoneTextureDao phoneTextureDao;

    @Transactional
    public void addPhoneTexture(PhoneTexture phoneTexture){
        phoneTextureDao.insertSelective(phoneTexture);
    }


    @Transactional
    public void updatePhoneTexture(PhoneTexture phoneTexture){
        phoneTextureDao.updateByPrimaryKeySelective(phoneTexture);
    }

    @Transactional
    public void deletePhoneTexture(Long id){
        phoneTextureDao.deleteByPrimaryKey(id);
    }

    public List<PhoneTexture> getPhoneTextures(PageResult pageResulte){
        return phoneTextureDao.getPhoneTextures(pageResulte.getBegin(),pageResulte.getPageSize());
    }

    public PhoneTexture getPhoneTextureById(Long id){
        return phoneTextureDao.selectByPrimaryKey(id);
    }

    @Transactional
    public void setSort(Long id,Integer sort){
        phoneTextureDao.setSort(id,sort);
    }

    @Transactional
    public void setIsAble(Long id,Integer isAble){
        phoneTextureDao.setIsAble(id,isAble);
    }
}
